const axios = require("axios");
let ajaxUrl = "http://192.168.2.23"
module.exports = class extends think.Service {
    post( url, param) {
        let axiosIns = axios.create({ //创建post请求
            baseURL: ajaxUrl,
            timeout: 30000,
            headers: {
                'Content-Type': 'application/json'
            }
        });
        return new Promise((resolve, reject) => {
            axiosIns.post(url, param).then(res => {
                if (res  ) {
                    resolve(res); 
                } else { //否则的话输出错误信息框
                    console.log(res.data.meta);
                    resolve(res)
                }
            })
        })
            
    };
}
